package com.dataart.training.crimequalification.domain;

import com.dataart.training.crimequalification.entity.DelinquentStateEntity;
import com.dataart.training.crimequalification.entity.MotiveEntity;
import com.dataart.training.crimequalification.entity.PurposeEntity;

public class SubjectiveSide {

    private Guilt guilt;

    private MotiveEntity motive;
    private boolean withMotive;

    private PurposeEntity purpose;
    private boolean withPurpose;

    private DelinquentStateEntity delinquentState;
    private boolean withDelinquentState;

    //-----------------------------------------------------

    public SubjectiveSide(Guilt guilt, MotiveEntity motive, PurposeEntity purpose,
                          DelinquentStateEntity delinquentState) {

        this.guilt = guilt;
        this.motive = motive;
        this.purpose = purpose;
        this.delinquentState = delinquentState;

        this.withMotive = motive != null;
        this.withPurpose = purpose != null;
        this.withDelinquentState = delinquentState != null;

    }

    //-----------------------------------------------------

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder("Субъективная сторона: [ ");

        sb.append(guilt.toString()).append(" [ Мотив: ");

        if (!withMotive) {
            sb.append("нет ]");
        } else {
            sb.append(motive.getTextualValue()).append("] ");
        }

        sb.append("[ Цель: ");
        if (withPurpose) {
            sb.append(purpose.getTextualValue()).append(" ]");
        } else {
            sb.append("нет ]");
        }

        sb.append("[ Состояние виновного: ");
        if (withDelinquentState) {
            sb.append(delinquentState.getTextualValue()).append(" ]");
        } else {
            sb.append("нет ]");
        }

        return sb.toString();

    }

    //-----------------------------------------------------

    public Guilt getGuilt() {
        return guilt;
    }

    public void setGuilt(Guilt guilt) {
        this.guilt = guilt;
    }

    public boolean isWithMotive() {
        return withMotive;
    }

    public void setWithMotive(boolean withMotive) {
        this.withMotive = withMotive;
    }

    public PurposeEntity getPurpose() {
        return purpose;
    }

    public void setPurpose(PurposeEntity purpose) {
        this.purpose = purpose;
    }

    public boolean isWithPurpose() {
        return withPurpose;
    }

    public void setWithPurpose(boolean withPurpose) {
        this.withPurpose = withPurpose;
    }

    public MotiveEntity getMotive() {
        return motive;
    }

    public void setMotive(MotiveEntity motive) {
        this.motive = motive;
    }

    public DelinquentStateEntity getDelinquentState() {
        return delinquentState;
    }

    public void setDelinquentState(DelinquentStateEntity delinquentState) {
        this.delinquentState = delinquentState;
    }

    public boolean isWithDelinquentState() {
        return withDelinquentState;
    }

    public void setWithDelinquentState(boolean withDelinquentState) {
        this.withDelinquentState = withDelinquentState;
    }
}
